package com.starblink.store.manage.adapter

import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.starblink.android.basic.adapter.BaseVH
import com.starblink.rocketreserver.fragment.MerchantWebVOF

class ManageStoresHolder(
    parent: ViewGroup, val selectStores: MutableList<Any>,
    val listener: (Int, MerchantWebVOF) -> Unit,
) : BaseVH<MerchantWebVOF>(ItemStoreManageView(parent.context)) {

    private val cardView = itemView as ItemStoreManageView

    init {
        val lp: RecyclerView.LayoutParams = RecyclerView.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT
        )
        itemView.layoutParams = lp
    }

    override fun onBind(post: MerchantWebVOF, position: Int) {
        cardView.bindPost(post, selectStores as MutableList<MerchantWebVOF>)
        itemView.setOnClickListener {
            listener.invoke(position, post)
        }
    }
}